#!/bin/sh
module="seq"
device="seq"

if [ -z "$1" ]; then
  seq_devices=4
else
  seq_devices=$1
fi

/sbin/insmod ./$module.o seq_devices=$seq_devices || exit 1

#remove stale nodes
rm -f /dev/${device}*

major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`
for ((i=0;i<seq_devices;i++))
do
  mknod /dev/${device}$i c $major $i
done

 mknod /dev/${device}_ c $major 7